import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {PageIndexComponent} from './doc/page-index/page-index.component';
import {PageDocComponent} from './doc/page-doc/page-doc.component';
import {PageApiComponent} from './doc/page-api/page-api.component';
import {PageHistoryComponent} from './doc/page-history/page-history.component';
import {PageInvokeComponent} from './doc/page-invoke/page-invoke.component';
import {OauthComponent} from './common/oauth/oauth.component';
import {UserInfoComponent} from './setting/user-info/user-info.component';
import {EnvComponent} from './setting/env/env.component';
import {PageInvokeDubboComponent} from './doc/page-invoke-dubbo/page-invoke-dubbo.component';
import {InvokeLogComponent} from './setting/invoke-log/invoke-log.component';
import {PageApiMockComponent} from './doc/page-api-mock/page-api-mock.component';
import {PageApiMockListComponent} from './doc/page-api-mock-list/page-api-mock-list.component';

const routes: Routes = [
    {path: '', component: PageIndexComponent},
    {path: 'user/oauth/:token', component: OauthComponent},
    {path: 'my/info', component: UserInfoComponent},

    {path: 'doc/:docId/history', component: PageHistoryComponent},
    {path: 'doc/:docId/env', component: EnvComponent},
    {path: 'doc/:docId/invoke-log', component: InvokeLogComponent},
    {path: 'doc/:docId/invoke-log/:apiId', component: InvokeLogComponent},
    {path: 'doc/:docId', component: PageDocComponent},

    {path: 'doc/:docId/v/:version', component: PageDocComponent},
    {path: 'doc/:docId/:apiId/v/:version', component: PageApiComponent},
    {path: 'doc/:docId/:apiId/call', component: PageInvokeComponent},
    {path: 'doc/:docId/:apiId/dubbo', component: PageInvokeDubboComponent},
    {path: 'doc/:docId/:apiId/mock', component: PageApiMockListComponent},
    {path: 'doc/:docId/:apiId/mock/:mockId', component: PageApiMockComponent},
    {path: 'doc/:docId/:apiId', component: PageApiComponent},
];

@NgModule({
    imports: [
        RouterModule.forRoot(routes, { relativeLinkResolution: 'legacy' })
    ],
    exports: [RouterModule]
})
export class AppRoutingModule {
}
